In general, a mass storage system is used for data storage. For example, the mass storage system can be a Solid State Drive (SSD) and/or a flash memory. Typically, the flash memory is made of flash electrically erasable and programmable read only memory cells. The memory cells are organized into a plurality of blocks. Each of the plurality of blocks comprises a plurality of pages where each page is configured to store data. Usually, during write operation and/or write cycle on the flash memory, data is written into the plurality of memory blocks. But, after a predetermined amount of time and due to frequent write cycles into the plurality of memory blocks, the plurality of memory blocks can become fully occupied having no free space to store further data for next write cycle. In such a scenario, a Flash Translation Layer (FTL) of the mass storage system triggers garbage collection, if a new write request is received for data storage in the plurality of memory blocks. The garbage collection is triggered to select a memory block among the plurality of memory blocks as a victim memory block for freeing up space i.e. erasing pages in the memory block in order to store the data in next write cycle in the freed-up pages.
In one conventional approach, the memory block is selected as a victim memory block among the plurality of memory blocks based on minimum number of valid pages contained in the memory block. The number of valid pages refers to number of pages currently in usage for data storage in the memory block. After selecting the memory block as the victim memory block, the valid pages of the memory block are collected in a separate block called garbage collection block. Then, the victim memory block is erased and converted into the garbage collection block which becomes a new memory block containing the data of the victim memory block. This garbage collection block being the new memory block having the data can be used for next garbage collection cycle and/or operation. However, there exists a problem when frequent erase and write cycles are carried out on the same memory block since the memory block becomes unusable for data storage after a finite number of erase and rewrite cycles. Such a frequent erase and write cycles on the same memory block leads to wearing of the memory block. Particularly, increased wearing of the target block leads to end of lifetime of the memory block for data storage.
The conventional approach performs write operation sequentially on each of the plurality of blocks to avoid uneven usage of the plurality of blocks for garbage collection. In such a way, the conventional approach avoids excessive wearing of each of the plurality of blocks. However, once the memory block i.e. the victim memory block is converted to the garbage collection block, the victim memory block is used for write operation in the next run of garbage collection. Hence, this victim memory block becomes the first block which is written second time in comparison to other plurality of blocks. In such a case, the conventional approach of victim block selection may lead to uneven wearing of a physical region of flash due to being rewritten first.